package com.ljx.itbbs.server.article.service.adapter;

import com.ljx.itbbs.server.article.domain.entity.CommentEntity;
import com.ljx.itbbs.server.article.domain.entity.CommentReplyEntity;
import com.ljx.itbbs.server.article.domain.vo.req.CommentSaveReq;

import java.util.Objects;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-03-25  20:40
 */
public class CommentAdapter {
    public static CommentEntity buildCommentSave(Long userId, CommentSaveReq req) {
        CommentEntity commentEntity = new CommentEntity();
        commentEntity.setContent(req.getContent());
        commentEntity.setArticleId(req.getArticleId());
        commentEntity.setUid(userId);
        commentEntity.setLikeNum(0);
        commentEntity.setReplyNum(0);
        return commentEntity;
    }

    public static CommentReplyEntity buildCommentReplySave(Long userId, CommentSaveReq req) {
        CommentReplyEntity commentReplyEntity = new CommentReplyEntity();
        commentReplyEntity.setContent(req.getContent());
        commentReplyEntity.setUid(userId);
        commentReplyEntity.setCommentId(req.getCommentId());
        commentReplyEntity.setReplyUid(req.getReplyUid());
        commentReplyEntity.setLikeNum(0);
        return commentReplyEntity;
    }
}
